#include <cstdio>>
//in the nearest past or in the future
//机试对于字符串的处理→C风格的字符串 以‘0’作为结尾 ex：char str[100]申请一个尽可能大的数组
//输入scanf 输出printf
//c++风格的字符串 string ： #include<string> using namespace std;
//初始化 string str1 = str;
//链接 str1 + world → helloworld;
//字符 str1[0] →h
// str1.length()
//判断相等 比较字典序（大小）
#include <string>
#include <map>
using namespace std;
int main(){
    //在前的为 键 key 在后的为值 value
    int mday[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
    string intToweekday[7]= {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
    map <string,int> monthToint = {
            {"January",1},
            {"February",2},
            {"March",3},
            {"April",4},
            {"May",5},
            {"June",6},
            {"July",7},
            {"August",8},
            {"September",9},
            {"October",10},
            {"November",11},
            {"December",12}
    };
    int year,mon,day;
    char str[100];
    string month;
    //9 October 2001
    bool isBefore;
    while (scanf("%d%s%d",&day,str,&year)!=EOF){
        month = str;//C→C++
        //注意输出的时候也要使用C风格的字符串 month.c_str()
//        if(month=="January"){
//            mon=1;
//            printf("mon = %d,month = %s\n",mon,month.c_str());
//        }
//另一种办法 使用map的映射 #include <map>
        mon = monthToint[month];
        if (year<2025
        ||2025 == year && mon < 1
        ||2025 == year && 1 == mon && day <17){
            isBefore = true;
        } else{
            isBefore = false;
        }
        int begYear,begMon,begDay,endYear,endMon,endDay;
        if (isBefore){
            begYear = year;
            begMon = mon;
            begDay = day;
            endYear = 2024;
            endMon = 1;
            endDay = 17;
        } else{
            begYear = 2025;
            begMon = 1;
            begDay = 17;
            endYear = year;
            endMon = mon;
            endDay = day;
        }//得到起点与终点
        int totalDay = 0;
        while (true){
            if (begYear == endYear && begMon == endMon && begDay == endDay){
                break;
            }
            ++totalDay;
            //next day
            bool isLeap = year%400==0 || year%100!=0 && year%4==0;
            if(isLeap){
                mday[2]=29;
            } else{
                mday[2]=28;
            }
            ++begDay;
            if(begDay > mday[begMon]){
                begDay = 1;
                ++begMon;
                if(begMon > 12){
                    begMon =1;
                    ++begYear;
                }
            }
        }
        if (isBefore){
            //(x+totalDay)%7=4→x = (11-totalDay%7)%7
            printf("%s\n",intToweekday[(11-totalDay%7)%7].c_str());
        } else{
            printf("%s\n",intToweekday[(totalDay+4)%7].c_str());
        }
    }
}